/*
 * Copyright 2021-2030 itbox.cn All right reserved. This software is the confidential and proprietary information
 * of itbox.cn ("Confidential Information"). You shall not disclose such Confidential Information and shall use it
 * only in accordance with the terms of the license agreement you entered into with itbox.cn.
 */
package cn.itbox.example.application.facotry;

import cn.itbox.example.domain.model.UserModel;
import cn.itbox.example.model.request.CreateUserRequest;
import cn.itbox.example.model.request.UpdateUserRequest;

/**
 * @BelongProject example
 * @BelongPackage cn.itbox.hyb.example.application.factory
 * @Description TODO
 * @ClassName UserFactory
 * @Author xingc
 * @Date 2024/1/4 12:33
 * @Version 1.0.0
 */
public class UserFactory {
    public static UserModel createUser(CreateUserRequest request) {
        UserModel model = UserModel.builder()
                .userName(request.getUserName())
                .realName(request.getRealName())
                .phone(request.getPhone())
                .password(request.getPassword())
                .build();
        return model;
    }

    public static UserModel updateUser(UpdateUserRequest request) {
        UserModel model = UserModel.builder()
                .userName(request.getUserName())
                .realName(request.getRealName())
                .phone(request.getPhone())
                .id(request.getId())
                .build();
        return model;
    }

    public static UserModel byId(Long id) {
        return UserModel.builder().id(id).build();
    }

}
